package cn.littlehx.spring_boot_test2_2.controller;

import cn.littlehx.spring_boot_test2_2.domain.Student;
import cn.littlehx.spring_boot_test2_2.service.StudentService;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/student")
public class StudentController {
    @Autowired
    StudentService studentService;
    @RequestMapping("/list")
    public String list(HttpServletRequest request, Model model){
        HttpSession session = request.getSession();
        Object userid = session.getAttribute("userid");
        if(userid == null){
            return "redirect:/login/user";

        }
//        List<Student> students = studentService.findALL();
//        model.addAttribute("data", students);
        return "student/list";
    }
    @RequestMapping("")
    public String hello(){
        return "hello";
    }
}

